package com.rpc.example.service;

import com.rpc.example.annotation.RpcMethod;
import com.rpc.example.annotation.RpcRemoteReference;
import com.rpc.example.annotation.RpcRemoteService;
import com.rpc.example.api.IUserService;
import com.rpc.example.api.IhelloService;
import lombok.extern.slf4j.Slf4j;

/**
 * @author Elvis
 * @version 1.0, 2022/11/10
 */
@Slf4j
@RpcRemoteService
public class UserServiceImpl implements IUserService {

    @RpcRemoteReference(serviceName = "provider-service2")
    private IhelloService ihelloService;
    @Override
    @RpcMethod
    public String saveUser(String userName) {
        log.info("save user : {}", userName);
        return "Save user success: " + userName;
    }

    @Override
    @RpcMethod
    public String getById(Long id) {
        log.info("getById : {}", id);
        return ihelloService.saveHello(id);
    }
}
